#include <iostream>
using namespace std;

int main(int argc, char* argv[])
{
	while( 1 )
	{
		int length = 0;
		cin >> length;
		if( length == 0 )
		{
			return 0;
		}

		int cut_count = 0;
		cin >> cut_count;

		int cuts[64] = {0};
		cuts[0] = 0;
		for( int i = 1; i <= cut_count; i++ )
		{
			cin >> cuts[i];
		}
		cuts[cut_count + 1] = length;

		int F[64][64] = {0};
		int S[64][64] = {0};
		for( int i = 0; i < cut_count; i++ )
		{
			F[i][i + 2] = cuts[i + 2] - cuts[i];
			S[i][i + 2] = i + 1;
		}

		for( int i = 3; i <= cut_count + 1; i++ )
		{
			for( int j = 0; j < cut_count + 2 - i; j++ )
			{
				int max = -1;
				int min = -1;
				for( int k = S[j+1][j+i]; k >= S[j][j+i-1]; k-- )
				{
					int p = F[j][k] + F[k][j+i];
					if( min == -1 || min > p )
					{
						min = p;
						max = k;
					}
				}
				F[j][j+i] = min + cuts[j + i] - cuts[j];
				S[j][j+i] = max;
			}
		}

		//The minimum cutting is 200.
		cout << "The minimum cutting is " << F[0][cut_count + 1] << "." << endl;
	}
	return 0;
}
